package com.cellulam.framework.core.enums;

import com.cellulam.framework.core.utils.EnumHelper;
import lombok.Getter;

/**
 * 操作符
 */
@Getter
public enum Operator implements CodeDescriptionFeature{

    EQUAL(1, "等于"),
    GREATER_THAN(2, "大于"),
    LESS_THAN(3, "小于"),
    GREATER_THAN_OR_EQUAL(4, "大于等于"),
    LESS_THAN_OR_EQUAL(5, "小于等于"),
    LIKE(6, "模糊查询"),
    IN(7, "in, 参数必须是一个集合"),
    NOT_IN(8, "not in, 参数必须是一个集合"),
    NOT_EQUAL(9, "不等于")

    ;

    private final int code;
    private final String description;

    Operator(int code, String description){
        this.code = code;
        this.description = description;
    }

    public static Operator valueOf(Integer code) {
        return EnumHelper.valueOf(code, Operator.class);
    }
}
